<%@page import="java.util.*"%>
<%@page import="java.text.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<%
    String path = request.getContextPath(); 
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+path+ "/"; 
     
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
    <style type="text/css">
    a{ text-decoration:none} 
    </style>
        <meta charset="utf-8">
        <base href="<%=basePath%>">
        <title>
                           提问回复
        </title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="css/x-admin.css" media="all">
        <link href="umeditor/themes/default/css/umeditor.css" type="text/css"
      	rel="stylesheet">
    </head>
    
    <body>
       <fieldset class="layui-elem-field">
				  <legend>提问详情</legend>
				  <div class="layui-field-box">
				      <form class="layui-form layui-form-pane" action="">
				          <input type="hidden" id="gId" value="${problem.gId}">
						  <div style="padding-bottom: 10px;padding-top: 10px">
						    <label style="font-size: 16px;"><strong>课程名称:</strong></label>
						    <label style="font-size: 16px">${problem.courseName}</label>
						  </div>
						
						  <div style="padding-bottom: 10px">
						    <label style="font-size: 16px;"><strong>提问人:</strong></label>
						    <label style="font-size: 16px">${problem.uName}</label>
						  </div>
						  
						  <div style="padding-bottom: 10px">
						    <label style="font-size: 16px;"><strong>提问时间:</strong></label>
						    <label style="font-size: 16px"><fmt:formatDate value="${problem.gCreatetime}" pattern="yyyy-MM-dd HH:mm"/></label>
						  </div>
						  
						  <div style="padding-bottom: 10px">
						    <label style="font-size: 16px;"><strong>提问内容:</strong></label>
						    <label style="font-size: 16px">
						        <img src="${problem.picture}" width="400px" height="200px">
						        <div style="margin-left: 115px;margin-top: 15px">
						            ${problem.gPutContent}
						        </div>
						    </label>
						  </div><hr>
						  
						  
				        <div style="padding-bottom: 10px">
						    <label style="font-size: 16px;"><strong>回复内容:</strong></label>
						    <label style="font-size: 16px">
						        <script type="text/plain" id="myEditor" class="form-control" style="width:100%;height:90%;"></script>
				                <input type="hidden" id="replyContent" name="replyContent">
						    </label>
					    </div>
							   
                     </form>
				  </div>
				  
				  
		      <div class="layui-form-item" style="margin-left:100px">
		            <label for="L_repass" class="layui-form-label">
		            </label>
		             <button type="submit"   onclick="save()"  class="layui-btn" >保存</button>
		             <button  class="layui-btn" onclick="parent.location.reload()">
		                                                                   取消
		            </button>
		       </div>
      </fieldset>
        <script src="js/jquery-3.2.1.min.js"></script>
        <script src="js/common2.js"></script>
        <!--ueditor插件js-->
		<script type="text/javascript"
			src="umeditor/third-party/template.min.js"></script>
		<script type="text/javascript" charset="utf-8"
			src="umeditor/umeditor.config.js"></script>
		<script type="text/javascript" charset="utf-8"
			src="umeditor/umeditor.js"></script>
        <script src="lib/layui/layui.js" charset="utf-8">
        </script>
        <script src="js/x-layui.js" charset="utf-8">
      
        </script>
        <script>
            layui.use(['form','layer'], function(){
                $ = layui.jquery;
              var form = layui.form()
              ,layer = layui.layer;
 
            });
            
        </script>
        <script>
        
        //实例化编辑器
		var um = UM.getEditor('myEditor');
		//失去焦点
		um.addListener('blur', function() {
			//判断是否有内容
			if (UM.getEditor('myEditor').hasContents()) {
				$("#replyContent").val(
						UM.getEditor('myEditor').getContent());
			}
		});
        
        var _hmt = _hmt || [];
        (function() {
          var hm = document.createElement("script");
          hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
          var s = document.getElementsByTagName("script")[0]; 
          s.parentNode.insertBefore(hm, s);
        })();
        
        
        function save() {
        	var gId = $("#gId").val();
			var replyContent = UM.getEditor('myEditor').getContent();
			if(replyContent==null || replyContent==""){
				layer.msg('回复内容不能为空!',{icon:2,time:2000});
				  return ;
			}
			 var  data = {"gId":gId,"replyContent":replyContent}
	         $.ajax({
	             type: "get",
	             url: "course/updateProblem",
	             data: data,
	             contentType:"application/json;charset=UTF-8", 
	             dataType:"json",
	             success: function(data){    
	           	 if(data.code==200){
	           		layer.alert(data.msg, {icon: 6},function () {
   	           		parent.location.reload();
	                    // 获得frame索引
	                    var index = parent.layer.getFrameIndex(window.name);
	                    //关闭当前frame
	                    parent.layer.close(index);
	                     parent.location.reload();
	                });  
				} else {
						 var txt=data.msg;
		      	    	   layer.alert(txt); 
					}
				}
			});
		}
        </script>
    </body>


</html>